package net.magicalcloud.magicalcloud.view.viewImpl.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

import net.magicalcloud.magicalcloud.R;
import net.magicalcloud.magicalcloud.adapter.CloudFilesAdapter;
import net.magicalcloud.magicalcloud.adapter.RecycleAdapter;
import net.magicalcloud.magicalcloud.adapter.VagueSearchFileAdapter;
import net.magicalcloud.magicalcloud.base.BaseActivity;
import net.magicalcloud.magicalcloud.entity.Files;
import net.magicalcloud.magicalcloud.presenter.RecyclePresenter;
import net.magicalcloud.magicalcloud.presenter.VagueSearchPresenter;
import net.magicalcloud.magicalcloud.view.EmptyRecyclerView;
import net.magicalcloud.magicalcloud.view.IRecycleView;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class RecycleActivity extends BaseActivity<IRecycleView,RecyclePresenter> implements IRecycleView{

    @BindView(R.id.recycleListView)
    EmptyRecyclerView recycleList;
    @BindView(R.id.bt_rash)
    Button buttonRash;
    @BindView(R.id.tv_null)
    TextView tvNull;

    private CloudFilesAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycle);
        List<Files> files = new ArrayList<>();
        adapter=new CloudFilesAdapter(files);
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        recycleList.setLayoutManager(linearLayoutManager);
        recycleList.setAdapter(adapter);
        recycleList.setEmptyView(tvNull);
    }

    @Override
    protected RecyclePresenter createPresenter() {
        return new RecyclePresenter();
    }

    @Override
    public void setList(List<Files> filesList) {
        buttonRash.setVisibility(View.GONE);
        adapter.updateData(filesList);
    }

    @OnClick(R.id.bt_rash)
    void rashRecycle(){
        mPresenter.show();
    }
}
